package com.travel.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

/**
 * 景点表
 * @TableName attractions
 */
@TableName(value ="attractions")
@Data
@Document(indexName = "attractions")
public class Attractions implements Serializable {

    /**
     * 景点id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 城市id
     */
    @TableField(value = "city_id")
    private Integer cityId;

    /**
     * 名字
     */
    @TableField(value = "name")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String name;

    /**
     * 中文名
     */
    @TableField(value = "cname")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String cname;

    /**
     * 
     */
    @TableField(value = "address")
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String address;

    /**
     * 联系电话
     */
    @TableField(value = "contactNumber")
    private Integer contactnumber;

    /**
     * 景点介绍
     */
    @TableField(value = "introduction")
    private String introduction;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Attractions other = (Attractions) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCityId() == null ? other.getCityId() == null : this.getCityId().equals(other.getCityId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCname() == null ? other.getCname() == null : this.getCname().equals(other.getCname()))
            && (this.getAddress() == null ? other.getAddress() == null : this.getAddress().equals(other.getAddress()))
            && (this.getContactnumber() == null ? other.getContactnumber() == null : this.getContactnumber().equals(other.getContactnumber()))
            && (this.getIntroduction() == null ? other.getIntroduction() == null : this.getIntroduction().equals(other.getIntroduction()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCityId() == null) ? 0 : getCityId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCname() == null) ? 0 : getCname().hashCode());
        result = prime * result + ((getAddress() == null) ? 0 : getAddress().hashCode());
        result = prime * result + ((getContactnumber() == null) ? 0 : getContactnumber().hashCode());
        result = prime * result + ((getIntroduction() == null) ? 0 : getIntroduction().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", cityId=").append(cityId);
        sb.append(", name=").append(name);
        sb.append(", cname=").append(cname);
        sb.append(", address=").append(address);
        sb.append(", contactnumber=").append(contactnumber);
        sb.append(", introduction=").append(introduction);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}